package com.aruba.camera3dapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    Button btn_pre1;
    Button btn_next1;
    Camera3DView camera3DView1;
    Camera3DView camera3DView2;
    Camera3DView camera3DView3;
    Camera3DView camera3DView4;
    Camera3DView camera3DView5;
    Camera3DView camera3DView6;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btn_pre1 = findViewById(R.id.btn_pre1);
        btn_next1 = findViewById(R.id.btn_next1);
        camera3DView1 = findViewById(R.id.camera3DView1);
        camera3DView2 = findViewById(R.id.camera3DView2);
        camera3DView2.setOrientation(Camera3DView.HORIZONTAL);

        camera3DView1.addResId(R.drawable.img1);
        camera3DView1.addResId(R.drawable.img2);
        camera3DView1.addResId(R.drawable.img3);
        camera3DView2.addResId(R.drawable.img1);
        camera3DView2.addResId(R.drawable.img2);
        camera3DView2.addResId(R.drawable.img3);

        //--------------百叶窗
        camera3DView3 = findViewById(R.id.camera3DView3);
        camera3DView4 = findViewById(R.id.camera3DView4);
        camera3DView4.setOrientation(Camera3DView.HORIZONTAL);
        camera3DView3.addResId(R.drawable.img1);
        camera3DView3.addResId(R.drawable.img2);
        camera3DView3.addResId(R.drawable.img3);
        camera3DView4.addResId(R.drawable.img1);
        camera3DView4.addResId(R.drawable.img2);
        camera3DView4.addResId(R.drawable.img3);

        //--------------滚动
        camera3DView5 = findViewById(R.id.camera3DView5);
        camera3DView6 = findViewById(R.id.camera3DView6);
        camera3DView6.setOrientation(Camera3DView.HORIZONTAL);
        camera3DView5.addResId(R.drawable.img1);
        camera3DView5.addResId(R.drawable.img2);
        camera3DView5.addResId(R.drawable.img3);
        camera3DView6.addResId(R.drawable.img1);
        camera3DView6.addResId(R.drawable.img2);
        camera3DView6.addResId(R.drawable.img3);
        
        btn_next1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                camera3DView1.next();
                camera3DView2.next();

                camera3DView3.next();
                camera3DView4.next();

                camera3DView5.next();
                camera3DView6.next();
            }
        });
        btn_pre1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                camera3DView1.pre();
                camera3DView2.pre();

                camera3DView3.next();
                camera3DView4.next();

                camera3DView5.next();
                camera3DView6.next();
            }
        });
    }
}
